<!DOCTYPE html>
<html>
<head>
    <title>管理员列表 - 后台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" type="text/css" href="../../../static/layui/css/layui.css" media="all">
    <script type="text/javascript" src="../../../static/layui/layui.js"></script>
    <style type="text/css">
        .header span{background:#009688;margin-left:30px;padding:10px;color:#ffffff;}
        .header div{border-bottom:solid 2px #009688;margin-top: 8px;}
        .header button{float:right;margin-top:-5px;}
    </style>
</head>
<body style="padding:10px; box-sizing: border-box;">
<div class="header">
    <span>导航列表</span>
    <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="add()">
        <i class="layui-icon layui-icon-add-1"></i>添加
    </button>
    <div></div>
</div>
<table class="layui-table">
    <thead>
    <tr>
        <th>ID</th>
        <th>标题</th>
        <th>作者</th>
        <th>所属栏目</th>
        <th>推荐</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach($lists as $lists_v)}
    <tr>
        <td>{$lists_v['id']}</td>
        <td>{$lists_v['title']}</td>
        <td>{$lists_v['author']}</td>
        <td>{$lists_v['titleen']}</td>
        <td>
            {if($lists_v['EC']==1)}
            已推荐
            {else/}
            未推荐
            {/if}
        </td>
        <td>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="modify({$lists_v.id})">
                <i class="layui-icon layui-icon-edit"></i>修改
            </button>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="deleted({$lists_v.id})">
                <i class="layui-icon layui-icon-delete"></i>删除
            </button>
        </td>
    </tr>
    {/foreach}
    </tbody>
</table>
</body>
<script>
    layui.use(['layer'],function (){
        $ = layui.jquery
    })
    function add(){
        layer.open({
            type:2,
            title:"添加用户",
            shade:0.3,
            area:['550px','550px'],
            content:'/tp5/public/index.php/bews/Article/articleAdd'
        })
    }


    function modify(id){
        layer.open({
            type: 2,
            title: '编辑用户',
            shade: 0.3,
            area: ['550px','550px'],
            content: '/tp5/public/index.php/bews/Article/articleModify?id='+id
        });
    }


    function deleted(id){
        layer.confirm('确定要删除吗？', {
            icon:3,
            btn: ['确定','取消']
        }, function(){
            $.post('/tp5/public/index.php/bews/Article/articleDel',{'id':id},function(res){
                if(res.code === 0){
                    layer.msg(res.msg,{'icon':1})
                    setTimeout(function (){
                        window.location.reload();   // 关闭上一层页面
                    },1000)
                }else{
                    layer.msg(res.msg,{'icon':2})
                }
            },'json');
        });
    }

</script>
</html>